final class ObjectDefinition {
	private static int[] anIntArray758;
	public boolean aBoolean759;
	private int anInt760;
	private int anInt761;
	public static Cache aCache_762 = new Cache(40);
	private int[] anIntArray763;
	public int anInt764;
	public boolean aBoolean765;
	private int anInt766;
	private static Packet aPacket_767;
	public boolean aBoolean769;
	public static Client aClient770;
	private static Model[] aModelArray771 = new Model[4];
	public static boolean aBoolean772;
	public int anInt773 = -1;
	private boolean aBoolean774 = true;
	public int anInt775;
	public String aString776 = "null";
	private static int anInt777;
	public int anInt778;
	public static Cache aCache_779 = new Cache(500);
	private int anInt780;
	public int anInt781;
	private static ObjectDefinition[] objects;
	public byte[] aByteArray783;
	private byte aByte784;
	private int anInt785;
	private boolean aBoolean786 = true;
	private byte aByte787;
	private int[] anIntArray789;
	public String[] aStringArray790;
	public boolean aBoolean791;
	private int[] anIntArray792;
	public int anInt794;
	public int anInt795;
	private int anInt796;
	public boolean aBoolean797;
	private boolean aBoolean798;
	private int[] anIntArray799;
	private static byte aByte800 = 6;
	public int anInt801;
	public int anInt802;
	public int anInt803;
	private boolean aBoolean804;
	public int[] anIntArray805;
	public int anInt806;
	public boolean aBoolean807;
	private static int anInt808;
	public boolean aBoolean809;
	public boolean aBoolean810;

	public static final ObjectDefinition method434(int i) {
		for (int i_0_ = 0; i_0_ < 20; i_0_++) {
			if (ObjectDefinition.objects[i_0_].anInt773 == i) {
				return ObjectDefinition.objects[i_0_];
			}
		}
		ObjectDefinition.anInt777 = (ObjectDefinition.anInt777 + 1) % 20;
		ObjectDefinition objectDefinition = ObjectDefinition.objects[ObjectDefinition.anInt777];
		ObjectDefinition.aPacket_767.offset = ObjectDefinition.anIntArray758[i];
		objectDefinition.anInt773 = i;
		objectDefinition.method440();
		objectDefinition.method441(ObjectDefinition.aByte800, ObjectDefinition.aPacket_767);
		return objectDefinition;
	}

	public final ObjectDefinition method435() {
		int i_1_ = -1;
		if (anInt778 != -1) {
			VarBit varBit = VarBit.aVarBitArray824[anInt778];
			int i_2_ = varBit.anInt826;
			int i_3_ = varBit.anInt827;
			int i_4_ = varBit.anInt828;
			int i_5_ = Client.anIntArray1214[i_4_ - i_3_];
			i_1_ = ObjectDefinition.aClient770.anIntArray1039[i_2_] >> i_3_ & i_5_;
		} else if (anInt781 != -1) {
			i_1_ = ObjectDefinition.aClient770.anIntArray1039[anInt781];
		}
		if (i_1_ < 0 || i_1_ >= anIntArray805.length || anIntArray805[i_1_] == -1) {
			return null;
		}
		return ObjectDefinition.method434(anIntArray805[i_1_]);
	}

	public final void method436(Class32_Sub1 class32_sub1) {
		if (anIntArray763 != null) {
			for (int element : anIntArray763) {
				class32_sub1.method337(element & 0xffff, 0);
			}
		}
	}

	public static final void getValues(Archive archive) {
		ObjectDefinition.aPacket_767 = new Packet(archive.method154("loc.dat",
			null));
		Packet packet = new Packet(archive.method154(
			"loc.idx", null));
		ObjectDefinition.anInt808 = packet.getUShort();
		ObjectDefinition.anIntArray758 = new int[ObjectDefinition.anInt808];
		int i = 2;
		for (int i_8_ = 0; i_8_ < ObjectDefinition.anInt808; i_8_++) {
			ObjectDefinition.anIntArray758[i_8_] = i;
			i += packet.getUShort();
		}
		ObjectDefinition.objects = new ObjectDefinition[20];
		for (int i_9_ = 0; i_9_ < 20; i_9_++) {
			ObjectDefinition.objects[i_9_] = new ObjectDefinition();
		}
	}

	private final Model method438(int i, int i_10_, int i_12_) {
		Model model = null;
		long l;
		if (anIntArray789 == null) {
			if (i_12_ != 10) {
				return null;
			}
			l = ((anInt773 << 6) + i) + ((long) (i_10_ + 1) << 32);
			Model model_13_ = (Model) ObjectDefinition.aCache_762
				.method345(l);
			if (model_13_ != null) {
				return model_13_;
			}
			if (anIntArray763 == null) {
				return null;
			}
			boolean bool = aBoolean798 ^ i > 3;
			int i_14_ = anIntArray763.length;
			for (int i_15_ = 0; i_15_ < i_14_; i_15_++) {
				int i_16_ = anIntArray763[i_15_];
				if (bool) {
					i_16_ += 65536;
				}
				model = ((Model) ObjectDefinition.aCache_779
					.method345(i_16_));
				if (model == null) {
					model = Model.method588(i_16_ & 0xffff);
					if (model == null) {
						return null;
					}
					if (bool) {
						model.method603(0);
					}
					ObjectDefinition.aCache_779.method346(model, i_16_);
				}
				if (i_14_ > 1) {
					ObjectDefinition.aModelArray771[i_15_] = model;
				}
			}
			if (i_14_ > 1) {
				model = (new Model(i_14_,
					ObjectDefinition.aModelArray771, (byte) -89));
			}
		} else {
			int i_17_ = -1;
			for (int i_18_ = 0; i_18_ < anIntArray789.length; i_18_++) {
				if (anIntArray789[i_18_] == i_12_) {
					i_17_ = i_18_;
					break;
				}
			}
			if (i_17_ == -1) {
				return null;
			}
			l = (((anInt773 << 6) + (i_17_ << 3) + i) + ((long) (i_10_ + 1) << 32));
			Model model_19_ = (Model) ObjectDefinition.aCache_762
				.method345(l);
			if (model_19_ != null) {
				return model_19_;
			}
			int i_20_ = anIntArray763[i_17_];
			boolean bool = aBoolean798 ^ i > 3;
			if (bool) {
				i_20_ += 65536;
			}
			model = ((Model) ObjectDefinition.aCache_779
				.method345(i_20_));
			if (model == null) {
				model = Model.method588(i_20_ & 0xffff);
				if (model == null) {
					return null;
				}
				if (bool) {
					model.method603(0);
				}
				ObjectDefinition.aCache_779.method346(model, i_20_);
			}
		}
		boolean bool;
		if (anInt780 != 128 || anInt760 != 128 || anInt796 != 128) {
			bool = true;
		} else {
			bool = false;
		}
		boolean bool_21_;
		if (anInt761 != 0 || anInt785 != 0 || anInt766 != 0) {
			bool_21_ = true;
		} else {
			bool_21_ = false;
		}
		Model model_22_ = new Model((i == 0
			&& i_10_ == -1 && !bool && !bool_21_), false, anIntArray799 == null,
			model, Class21.method239(i_10_));
		if (i_10_ != -1) {
			model_22_.method595(7);
			model_22_.method596(i_10_, (byte) 6);
			model_22_.anIntArrayArray1679 = null;
			model_22_.anIntArrayArray1678 = null;
		}
		while (i-- > 0) {
			model_22_.method599(true);
		}
		if (anIntArray799 != null) {
			for (int i_23_ = 0; i_23_ < anIntArray799.length; i_23_++) {
				model_22_.method602(anIntArray799[i_23_], anIntArray792[i_23_]);
			}
		}
		if (bool) {
			model_22_.method604(anInt760, anInt796, 9, anInt780);
		}
		if (bool_21_) {
			model_22_.method601(anInt761, anInt766, false, anInt785);
		}
		model_22_.preProcess(aByte784 + 64, aByte787 * 5 + 768, -50, -10, -50,
			!aBoolean804);
		if (anInt794 == 1) {
			model_22_.anInt1675 = model_22_.anInt1475;
		}
		ObjectDefinition.aCache_762.method346(model_22_, l);
		return model_22_;
	}

	public final boolean method439() {
		if (anIntArray763 == null) {
			return true;
		}
		boolean bool = true;
		for (int element : anIntArray763) {
			bool &= Model.method589(element & 0xffff);
		}
		return bool;
	}

	private final void method440() {
		anIntArray763 = null;
		anIntArray789 = null;
		aString776 = "null";
		aByteArray783 = null;
		anIntArray799 = null;
		anIntArray792 = null;
		anInt801 = 1;
		anInt775 = 1;
		aBoolean810 = true;
		aBoolean809 = true;
		aBoolean759 = false;
		aBoolean769 = false;
		aBoolean804 = false;
		aBoolean797 = false;
		anInt803 = -1;
		anInt802 = 16;
		aByte784 = (byte) 0;
		aByte787 = (byte) 0;
		aStringArray790 = null;
		anInt806 = -1;
		anInt795 = -1;
		aBoolean798 = false;
		aBoolean807 = true;
		anInt780 = 128;
		anInt760 = 128;
		anInt796 = 128;
		anInt764 = 0;
		anInt761 = 0;
		anInt785 = 0;
		anInt766 = 0;
		aBoolean765 = false;
		aBoolean791 = false;
		anInt794 = -1;
		anInt778 = -1;
		anInt781 = -1;
		anIntArray805 = null;
	}

	private final void method441(byte i, Packet packet) {
		int i_25_ = -1;
		if (i != 6) {
			throw new NullPointerException();
		}
		for (;;) {
			int i_26_ = packet.getUByte();
			if (i_26_ == 0) {
				break;
			}
			if (i_26_ == 1) {
				int i_27_ = packet.getUByte();
				if (i_27_ > 0) {
					if (anIntArray763 == null || ObjectDefinition.aBoolean772) {
						anIntArray789 = new int[i_27_];
						anIntArray763 = new int[i_27_];
						for (int i_28_ = 0; i_28_ < i_27_; i_28_++) {
							anIntArray763[i_28_] = packet.getUShort();
							anIntArray789[i_28_] = packet.getUByte();
						}
					} else {
						packet.offset += i_27_ * 3;
					}
				}
			} else if (i_26_ == 2) {
				aString776 = packet.getString();
			} else if (i_26_ == 3) {
				aByteArray783 = packet.getBytes();
			} else if (i_26_ == 5) {
				int i_29_ = packet.getUByte();
				if (i_29_ > 0) {
					if (anIntArray763 == null || ObjectDefinition.aBoolean772) {
						anIntArray789 = null;
						anIntArray763 = new int[i_29_];
						for (int i_30_ = 0; i_30_ < i_29_; i_30_++) {
							anIntArray763[i_30_] = packet.getUShort();
						}
					} else {
						packet.offset += i_29_ * 2;
					}
				}
			} else if (i_26_ == 14) {
				anInt801 = packet.getUByte();
			} else if (i_26_ == 15) {
				anInt775 = packet.getUByte();
			} else if (i_26_ == 17) {
				aBoolean810 = false;
			} else if (i_26_ == 18) {
				aBoolean809 = false;
			} else if (i_26_ == 19) {
				i_25_ = packet.getUByte();
				if (i_25_ == 1) {
					aBoolean759 = true;
				}
			} else if (i_26_ == 21) {
				aBoolean769 = true;
			} else if (i_26_ == 22) {
				aBoolean804 = true;
			} else if (i_26_ == 23) {
				aBoolean797 = true;
			} else if (i_26_ == 24) {
				anInt803 = packet.getUShort();
				if (anInt803 == 65535) {
					anInt803 = -1;
				}
			} else if (i_26_ == 28) {
				anInt802 = packet.getUByte();
			} else if (i_26_ == 29) {
				aByte784 = packet.getByte();
			} else if (i_26_ == 39) {
				aByte787 = packet.getByte();
			} else if (i_26_ >= 30 && i_26_ < 39) {
				if (aStringArray790 == null) {
					aStringArray790 = new String[5];
				}
				aStringArray790[i_26_ - 30] = packet.getString();
				if (aStringArray790[i_26_ - 30].equalsIgnoreCase("hidden")) {
					aStringArray790[i_26_ - 30] = null;
				}
			} else if (i_26_ == 40) {
				int i_31_ = packet.getUByte();
				anIntArray799 = new int[i_31_];
				anIntArray792 = new int[i_31_];
				for (int i_32_ = 0; i_32_ < i_31_; i_32_++) {
					anIntArray799[i_32_] = packet.getUShort();
					anIntArray792[i_32_] = packet.getUShort();
				}
			} else if (i_26_ == 60) {
				anInt806 = packet.getUShort();
			} else if (i_26_ == 62) {
				aBoolean798 = true;
			} else if (i_26_ == 64) {
				aBoolean807 = false;
			} else if (i_26_ == 65) {
				anInt780 = packet.getUShort();
			} else if (i_26_ == 66) {
				anInt760 = packet.getUShort();
			} else if (i_26_ == 67) {
				anInt796 = packet.getUShort();
			} else if (i_26_ == 68) {
				anInt795 = packet.getUShort();
			} else if (i_26_ == 69) {
				anInt764 = packet.getUByte();
			} else if (i_26_ == 70) {
				anInt761 = packet.getShort();
			} else if (i_26_ == 71) {
				anInt785 = packet.getShort();
			} else if (i_26_ == 72) {
				anInt766 = packet.getShort();
			} else if (i_26_ == 73) {
				aBoolean765 = true;
			} else if (i_26_ == 74) {
				aBoolean791 = true;
			} else if (i_26_ == 75) {
				anInt794 = packet.getUByte();
			} else if (i_26_ == 77) {
				anInt778 = packet.getUShort();
				if (anInt778 == 65535) {
					anInt778 = -1;
				}
				anInt781 = packet.getUShort();
				if (anInt781 == 65535) {
					anInt781 = -1;
				}
				int i_33_ = packet.getUByte();
				anIntArray805 = new int[i_33_ + 1];
				for (int i_34_ = 0; i_34_ <= i_33_; i_34_++) {
					anIntArray805[i_34_] = packet.getUShort();
					if (anIntArray805[i_34_] == 65535) {
						anIntArray805[i_34_] = -1;
					}
				}
			}
		}
		if (i_25_ == -1) {
			aBoolean759 = false;
			if (anIntArray763 != null && (anIntArray789 == null || anIntArray789[0] == 10)) {
				aBoolean759 = true;
			}
			if (aStringArray790 != null) {
				aBoolean759 = true;
			}
		}
		if (aBoolean791) {
			aBoolean810 = false;
			aBoolean809 = false;
		}
		if (anInt794 == -1) {
			anInt794 = aBoolean810 ? 1 : 0;
		}
	}

	public final Model method442(int i, int i_35_, int i_36_, int i_37_,
		int i_38_, int i_39_, int i_40_) {
		Model model = method438(i_35_, i_40_, i);
		if (model == null) {
			return null;
		}
		if (aBoolean769 || aBoolean804) {
			model = new Model(aBoolean769, aBoolean804, 0,
				model);
		}
		if (aBoolean769) {
			int i_41_ = (i_36_ + i_37_ + i_38_ + i_39_) / 4;
			for (int i_42_ = 0; i_42_ < model.anInt1648; i_42_++) {
				int i_43_ = model.anIntArray1649[i_42_];
				int i_44_ = model.anIntArray1651[i_42_];
				int i_45_ = i_36_ + (i_37_ - i_36_) * (i_43_ + 64) / 128;
				int i_46_ = i_39_ + (i_38_ - i_39_) * (i_43_ + 64) / 128;
				int i_47_ = i_45_ + (i_46_ - i_45_) * (i_44_ + 64) / 128;
				model.anIntArray1650[i_42_] += i_47_ - i_41_;
			}
			model.method593(6);
		}
		return model;
	}

	public final boolean method443(int i, int i_48_) {
		if (i != 26261) {
			aBoolean786 = !aBoolean786;
		}
		if (anIntArray789 == null) {
			if (anIntArray763 == null) {
				return true;
			}
			if (i_48_ != 10) {
				return true;
			}
			boolean bool = true;
			for (int element : anIntArray763) {
				bool &= Model.method589(element & 0xffff);
			}
			return bool;
		}
		for (int i_50_ = 0; i_50_ < anIntArray789.length; i_50_++) {
			if (anIntArray789[i_50_] == i_48_) {
				return Model.method589(anIntArray763[i_50_] & 0xffff);
			}
		}
		return true;
	}

	public static final void method444() {
		ObjectDefinition.aCache_779 = null;
		ObjectDefinition.aCache_762 = null;
		ObjectDefinition.anIntArray758 = null;
		ObjectDefinition.objects = null;
		ObjectDefinition.aPacket_767 = null;
	}
}
